import {
	clearStorage,
	
	getToken,
	setToken,
	removeToken,
	
	getPhone,
	setPhone,
	removePhone,
	
	getUser,
	setUser,
	removeUser
} from "./auth.js"

/**
 * 判断用户是否登录
 */
export function wxCheckLogin() {
	return new Promise(function(resolve, reject) {
		if (getPhone() && getToken()) {
			resolve(true);
		} else {
			clearStorage()
			reject(false);
		}

	});
}
/**
 * 判断用户是否授权手机号
 */
export function wxCheckPhone() {
	return new Promise(function(resolve, reject) {
		if (getUser()) {
			if (getUser().phonenumber) {
				resolve(true)
			} else {
				reject(false);
			}
		} else {
			reject(false);
		}

	});
}
